statusicon: use absolute delta to find the nearest icon size
authorFernando Lemos <fernandotcl@gmail.com>
Tue, 15 May 2012 14:28:37 +0000 (10:28 -0400)
committerCosimo Cecchi <cosimoc@gnome.org>
Tue, 15 May 2012 14:34:28 +0000 (10:34 -0400)
Otherwise, if we only look at (pixel_size - stock_size), we miss the
case when the pixel size is smaller than any provided stock size.

https://bugzilla.gnome.org/show_bug.cgi?id=673749

gtk/gtkstatusicon.c

index 8bcb63807176f18f76ffbd9031832097a6bf9f9d..efecdadc2844ddd51f465281a2057bc52058686f 100644 (file)
@@ -1328,10 +1328,9 @@ round_pixel_size (GtkWidget *widget,
 
   for (s = GTK_ICON_SIZE_MENU; s <= GTK_ICON_SIZE_DIALOG; s++)
     {
-      if (gtk_icon_size_lookup_for_settings (settings, s, &w, &h) &&
-         w <= pixel_size && h <= pixel_size)
+      if (gtk_icon_size_lookup_for_settings (settings, s, &w, &h))
        {
-         d = MAX (pixel_size - w, pixel_size - h);
+         d = MAX (abs (pixel_size - w), abs (pixel_size - h));
          if (d < dist)
            {
              dist = d;